﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EIS.ClientUtility;
namespace EIS.ConfigViews
{
    public partial class GeneralConfig : Form
    {
        private ClientConfig config = ClientConfig.Instance;
        public GeneralConfig()
        {
            InitializeComponent();
            this.tbDisplayDays.Text = config.DisplayDaysForFunctionDate.ToString();
            this.tbDataSyncInterval.Text = (config.FetchTransactionDataInterval/1000).ToString();
            this.chkMarkRow.Checked = config.MarkReadAfterSelectRow;
        }

        private void labelInstruction_Click(object sender, EventArgs e)
        {

        }

        private void tbCurrentUser_TextChanged(object sender, EventArgs e)
        {

        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            config.FetchTransactionDataInterval = (Int16.Parse(this.tbDataSyncInterval.Text))*1000;
            config.DisplayDaysForFunctionDate = Int16.Parse(this.tbDisplayDays.Text);
            config.MarkReadAfterSelectRow = this.chkMarkRow.Checked;
            
            config.UpdateBasicConfig();
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
